<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录 - 养老院管理系统</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
    <link rel="stylesheet" th:href="@{/css/main.css}">
</head>
<body>
<div class="auth-wrapper">
    <div class="auth-card">
        <div class="card-header">
            <h4 class="text-primary">养老院管理系统</h4>
            <h5>登录</h5>
        </div>
        <div class="card-body">
            <div th:if="${param.error}" class="alert alert-danger">
                用户名或密码错误，请重试。
            </div>
            <div th:if="${param.logout}" class="alert alert-success">
                您已成功退出登录。
            </div>
            <form th:action="@{/login}" method="post" class="needs-validation" novalidate>
                <div class="form-group">
                    <label for="username">用户名</label>
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text"><i class="fas fa-user"></i></span>
                        </div>
                        <input type="text" class="form-control" id="username" name="username" required autofocus>
                        <div class="invalid-feedback">
                            请输入用户名
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="password">密码</label>
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text"><i class="fas fa-lock"></i></span>
                        </div>
                        <input type="password" class="form-control" id="password" name="password" required>
                        <div class="input-group-append">
                            <button class="btn btn-outline-secondary toggle-password" type="button" data-target="#password">显示</button>
                        </div>
                        <div class="invalid-feedback">
                            请输入密码
                        </div>
                    </div>
                </div>
                <div class="form-group form-check">
                    <input type="checkbox" class="form-check-input" id="remember-me" name="remember-me">
                    <label class="form-check-label" for="remember-me">记住我</label>
                </div>
                <button type="submit" class="btn btn-primary btn-block">登录</button>
            </form>
            <div class="text-center mt-3">
                <a th:href="@{/register}" class="text-decoration-none">没有账号？注册</a>
            </div>
        </div>
        <div class="card-footer text-center text-muted">
            <small>&copy; 2023 养老院管理系统</small>
        </div>
    </div>
</div>

<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"></script>
<script th:src="@{/js/main.js}"></script>
</body>
</html>